/**
 * author: wangcheng
 * date: 2018/08/17
 * des: 动薪申请
 *
 */

import {
  findEmployeeDetail,
  findsalary,
  findLevel,
  findSalaryByLevel

} from './api.js'

/**
 * 高级搜索
 */
export const searchSetting = [{
  field: 'employeeNo',
  title: '员工编号',
  type: 'text',
  searchable: true
},
{
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  searchable: true
},
{
  field: 'targetOrgId',
  title: '部门',
  type: 'org',
  searchable: true
},
// {
//   field: 'targetPost',
//   title: '岗位',
//   type: 'selected',
//   isParams: true,
//   paramsId: 'POST',
//   searchable: true
// },
// {
//   field: 'targetPostLevel',
//   title: '职级',
//   type: 'selected',
//   isParams: true,
//   paramsId: 'RANK',
//   searchable: true
// },
// {
//   field: 'entryDate',
//   title: '入职日期',
//   type: 'date',
//   searchable: true
// },
{
  field: 'status',
  title: '状态',
  type: 'selected',
  searchable: true,
  options: [{
    name: '填写动薪',
    value: '1'
  },
  {
    name: '审批通过',
    value: '2'
  },
  {
    name: '已放弃',
    value: '9'
  }
  ]
}
]




/**
 * 新增年度申请
 *
 */
export const addYearSetting = [{
  field: 'employeeNo',
  title: '员工',
  type: 'user',
  //  itemChange: (form,itemSetting,setting)
  itemChange: (form, itemSetting, setting) => {
    if (form.employeeNo) {
      findEmployeeDetail(form.employeeNo).then((response) => {
        const baseUserData = response.data
        findsalary(form.employeeNo).then((response) => {
          const obj = Object.assign(baseUserData, response.data)
          form.entryDate = obj.entryDate
          form.orgId = obj.orgId
          form.position = obj.position
          form.postLevel = obj.postLevel
          //            entryDate,orgId,position,postLevel, targetLevel,salaryLow,salaryHigh,baseSalary,postLevelSalary,postAllowance,
          // achievementBonus,fullAttendenceReward,otherReward
          form.originalSalary = obj.salary
          form.baseSalary = obj.baseSalary
          form.postLevelSalary = obj.postLevelSalary
          form.postAllowance = obj.postAllowance
          form.achievementBonus = obj.achievementBonus
          form.fullAttendenceReward = obj.fullAttendenceReward
          form.otherReward = obj.otherReward
          form.salary = obj.salary
          const params = {
            orgId: obj.orgId,
            postId: obj.position
          }
          const options = []
          findLevel(params).then((response) => { // 根据部门查询岗位
            if (response.data !== undefined) {
              if (response.success) {
                // console.log(response.data)
                response.data.forEach((v, index) => {
                  const obj = {
                    value: v.id,
                    name: v.name
                  }
                  options.push(obj)
                })
                form.targetPostLevel = ''
                form.salaryLow = ''
                form.salaryHigh = ''
                addYearSetting.forEach(v => {
                  if (v.field === 'targetPostLevel') {
                    v.options = options
                  }
                })
              }
            }
          })
        })
      })
    }
  }
},

{
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'orgId',
  title: '部门',
  type: 'org',
  searchable: true,
  disableEdit: true

},
{
  field: 'position',
  title: '原岗位',
  type: 'selected',
  isParams: true,
  paramsId: 'POST',
  disableEdit: true
},
{
  field: 'postLevel',
  title: '原职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
}, {
  field: 'targetPostLevel',
  title: '目标职级',
  type: 'selected',
  options: [],
  itemChange: (form, itemSetting, setting) => {
    if (form.targetPostLevel) {
      const params = {
        orgId: form.orgId,
        postId: form.position,
        postLevel: form.targetPostLevel
      }
      if (form.targetPostLevel) {
        findSalaryByLevel(params).then((response) => {
          form.salaryLow = response.data.salaryLow
          form.salaryHigh = response.data.salaryHigh
        })
      }
    }
  }
},
{
  field: 'salaryLow',
  title: '最低薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'salaryHigh',
  title: '最高薪资',
  type: 'text',
  disableEdit: true
},

{
  field: 'baseSalary',
  title: '原基本底薪',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetBaseSalary',
  title: '目标基本薪资',
  type: 'text'
}, {
  field: 'postLevelSalary',
  title: '原级别工资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetPostSalary',
  title: '目标级别薪资',
  type: 'text'
},
{
  field: 'postAllowance',
  title: '原岗位津贴',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAllowance',
  title: '目标岗位津贴',
  type: 'text'
}, {
  field: 'achievementBonus',
  title: '原绩效奖金',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAchievementBonus',
  title: '目标绩效奖金',
  type: 'text'
}, {
  field: 'fullAttendenceReward',
  title: '原全勤奖',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetFullattendReward',
  title: '目标全勤奖',
  type: 'text'
}, {
  field: 'otherReward',
  title: '原其他',
  type: 'text',
  disableEdit: true
},
{
  field: 'targetOtherReward',
  title: '其他',
  type: 'text'
},
{
  field: 'salary',
  title: '原薪资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetSalary',
  title: '目标薪资',
  type: 'text',
  disableEdit: true,
  formChange: (form, setting) => {
    form.targetSalary = Number(form.targetBaseSalary) + Number(form.targetPostSalary) + Number(form.targetAllowance) + Number(form.targetAchievementBonus) + Number(form.targetFullattendReward) + Number(form.targetOtherReward)
  }
},
{
  field: 'effectDate',
  title: '生效日期',
  type: 'date'
}
]


/**
 * 入职列表的set
 */

export const delayListSetting = [{
  field: 'id',
  title: 'id',
  type: 'text',
  isHiden: true
},
{
  field: 'employeeNo',
  title: '员工编号',
  type: 'text',
  searchable: true
},
{
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  searchable: true
},
{
  field: 'orgName',
  title: '部门',
  type: 'text',
  searchable: true
},
{
  field: 'position',
  title: '岗位',
  type: 'selected',
  isParams: true,
  paramsId: 'POST',
  searchable: true
},
{
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  searchable: true
},
{
  field: 'statusName',
  title: '状态',
  type: 'text'
},
{
  field: 'status',
  title: '状态',
  type: 'text',
  isHiden: true
},
{
  field: 'taskDefKey',
  title: 'taskDefKey',
  type: 'text',
  isHiden: true
}
]


/**
 * 入职详情set
 */

export const delayDetailSetting = [{
  field: 'id',
  title: 'id',
  type: 'text',
  hideEdit: true,
  hideDetail: true
},
{
  field: 'employeeNo',
  title: '员工编号',
  type: 'text',
  disableEdit: true
},
{
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetOrgId',
  title: '部门',
  type: 'org',
  disableEdit: true
},
{
  field: 'targetPost',
  title: '岗位',
  type: 'selected',
  isParams: true,
  paramsId: 'POST',
  disableEdit: true
},

{
  field: 'targetPostLevel',
  title: '职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
},

{
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'targetWorkAddr',
  title: '工作地点',
  type: 'selected',
  isParams: true,
  paramsId: 'WORKPLACE'
},

{
  field: 'targetCompany',
  title: '合同公司',
  type: 'contract-company',
  disableEdit: true
},

{
  field: 'targetPost',
  title: '岗位',
  type: 'text',
  hideEdit: true,
  hideDetail: true
},
{
  field: 'targetPostLevel',
  title: '职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  hideEdit: true,
  hideDetail: true
}, {
  field: 'targetOrgId',
  title: '目标部门',
  type: 'text',
  disableEdit: true,
  hideEdit: true,
  hideDetail: true
},
{
  field: 'salaryLow',
  title: '最低薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'salaryHigh',
  title: '最高薪资',
  type: 'text',
  disableEdit: true
},

{
  field: 'targetBaseSalary',
  title: '基本薪资',
  type: 'text'
}, {
  field: 'targetPostSalary',
  title: '岗位级别薪资',
  type: 'text'
}, {
  field: 'targetAllowance',
  title: '岗位津贴',
  type: 'text'
}, {
  field: 'targetAchievementBonus',
  title: '岗位绩效奖金',
  type: 'text'
}, {
  field: 'targetFullattendReward',
  title: '全勤奖',
  type: 'text'
}, {
  field: 'targetOtherReward',
  title: '其他',
  type: 'text'
},
{
  field: 'targetSalary',
  title: '总薪资',
  type: 'text',
  disableEdit: true

},
{
  field: 'effectDate',
  title: '生效日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'docList',
  title: '简历附件',
  type: 'file',
  busiKey: 'employeeNo',
  disableEdit: true
}
]

/**
 * 入职审批set
 */

export const delayApproveSetting = [{
  field: 'id',
  title: 'id',
  type: 'text',
  hideEdit: true
},
{
  field: 'employeeNo',
  title: '员工编号',
  type: 'text',
  disableEdit: true
},
{
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetOrgId',
  title: '部门',
  type: 'org',
  disableEdit: true
},
{
  field: 'targetPost',
  title: '岗位',
  type: 'selected',
  isParams: true,
  paramsId: 'POST',
  disableEdit: true
},

{
  field: 'targetPostLevel',
  title: '职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
},

{
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'targetWorkAddr',
  title: '工作地点',
  type: 'selected',
  isParams: true,
  paramsId: 'WORKPLACE',
  disableEdit: true
},

{
  field: 'targetCompany',
  title: '合同公司',
  type: 'contract-company',
  disableEdit: true
},

{
  field: 'targetPost',
  title: '岗位',
  type: 'text',
  hideEdit: true
},
{
  field: 'targetPostLevel',
  title: '职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  hideEdit: true
}, {
  field: 'targetOrgId',
  title: '目标部门',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'salaryLow',
  title: '最低薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'salaryHigh',
  title: '最高薪资',
  type: 'text',
  disableEdit: true
},

{
  field: 'targetBaseSalary',
  title: '基本薪资',
  type: 'text'
}, {
  field: 'targetPostSalary',
  title: '岗位级别薪资',
  type: 'text'
}, {
  field: 'targetAllowance',
  title: '岗位津贴',
  type: 'text'
}, {
  field: 'targetAchievementBonus',
  title: '岗位绩效奖金',
  type: 'text'
}, {
  field: 'targetFullattendReward',
  title: '全勤奖',
  type: 'text'
}, {
  field: 'targetOtherReward',
  title: '其他',
  type: 'text'
},
{
  field: 'targetSalary',
  title: '总薪资',
  type: 'text',
  disableEdit: true,
  showEditSituation: (form) => {
    form.targetSalary = Number(form.targetBaseSalary) + Number(form.targetPostSalary) + Number(form.targetAllowance) + Number(form.targetAchievementBonus) + Number(form.targetFullattendReward) + Number(form.targetOtherReward)
    return true
  }

},
{
  field: 'approvalOpinion',
  title: '审批意见',
  type: 'textarea',
  onlyRow: true
},
{
  field: 'taskId',
  title: 'taskId',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'action',
  title: 'action',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'taskDefKey',
  title: 'taskDefKey',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'procInstId',
  title: 'procInstIdww',
  type: 'text',
  disableEdit: true,
  hideEdit: true
}
]
/**
 * 转正的list
 */
export const conrrectionListSetting = [{
  field: 'id',
  title: 'id',
  type: 'text',
  isHiden: true
},
{
  field: 'employeeNo',
  title: '员工编号',
  type: 'text',
  searchable: true
},
{
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  searchable: true
},
{
  field: 'orgName',
  title: '部门',
  type: 'text',
  searchable: true
},
{
  field: 'position',
  title: '岗位',
  type: 'selected',
  isParams: true,
  paramsId: 'POST',
  searchable: true
},
{
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  searchable: true
},
{
  field: 'statusName',
  title: '状态',
  type: 'text'
},
{
  field: 'status',
  title: '状态',
  type: 'text',
  isHiden: true
},
{
  field: 'taskDefKey',
  title: 'taskDefKey',
  type: 'text',
  isHiden: true
}
]

/**
 * 转正的详情
 */
export const conrrectionDetailSetting = [{
  field: 'id',
  title: 'id',
  type: 'text',
  hideDetail: true
},
{
  field: 'employeeNo',
  title: '员工编号',
  type: 'text'
},
{
  field: 'employeeName',
  title: '员工名称',
  type: 'text'
},
{
  field: 'turnoverType',
  title: '异动类型',
  type: 'radio',
  disableEdit: true,
  customText: (item) => {
    switch (item.turnoverType) {
      case '4':
        return '降级'
      case '3':
        return '晋升'
      case '5':
        return '调岗'
    }
  },
  optional: [{
    name: '调岗',
    value: '5'
  },
  {
    name: '晋升',
    value: '3'
  },
  {
    name: '降级',
    value: '4'
  }
  ]
},
{
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'planCorrectionDate',
  title: '计划转正日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'conrrectionDate',
  title: '实际转正日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'originalOrgId',
  title: '原部门',
  type: 'org',
  disableEdit: true
},
{
  field: 'targetOrgId',
  title: '目标部门',
  type: 'org',
  disableEdit: true
},

{
  field: 'originalPost',
  title: '原岗位',
  type: 'text',
  disableEdit: true
},
{
  field: 'targetPost',
  title: '目标岗位',
  type: 'text',
  disableEdit: true
},
{
  field: 'originalPostLevel',
  title: '原职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
},

{
  field: 'targetPostLevel',
  title: '目标职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK'
}, {
  field: 'salaryLow',
  title: '最低薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'salaryHigh',
  title: '最高薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'originalBaseSalary',
  title: '原基本底薪',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetBaseSalary',
  title: '目标基本底薪',
  type: 'text'
}, {
  field: 'originalPostSalary',
  title: '原岗位工资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetPostSalary',
  title: '目标岗位工资',
  type: 'text'
},
{
  field: 'originalAllowance',
  title: '原岗位津贴',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAllowance',
  title: '目标岗位津贴',
  type: 'text'
}, {
  field: 'originalAchievementBonus',
  title: '原绩效奖金',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAchievementBonus',
  title: '目标绩效奖金',
  type: 'text'
}, {
  field: 'originalFullattendReward',
  title: '原全勤奖',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetFullattendReward',
  title: '目标全勤奖',
  type: 'text'
}, {
  field: 'originalOtherReward',
  title: '原其他',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetOtherReward',
  title: '其他',
  type: 'text'
}, {
  field: 'originalSalary',
  title: '原薪资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetSalary',
  title: '目标薪资',
  type: 'text'
}, {
  field: 'effectDate',
  title: '生效日期',
  type: 'date',
  disableEdit: true
}
]

/**
 * 转正的审批
 */
export const conrrectionApproveSetting = [{
  field: 'id',
  title: 'id',
  type: 'text',
  hideEdit: true,
  disableEdit: true
},
{
  field: 'employeeNo',
  title: '员工编号',
  type: 'text',
  disableEdit: true
},
{
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  disableEdit: true
},
{
  field: 'turnoverType',
  title: '异动类型',
  type: 'radio',
  disableEdit: true,
  customText: (item) => {
    switch (item.turnoverType) {
      case '4':
        return '降级'
      case '3':
        return '晋升'
      case '5':
        return '调岗'
    }
  },
  optional: [{
    name: '调岗',
    value: '5'
  },
  {
    name: '晋升',
    value: '3'
  },
  {
    name: '降级',
    value: '4'
  }
  ]
},
{
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'planCorrectionDate',
  title: '计划转正日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'conrrectionDate',
  title: '转正日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'originalOrgId',
  title: '原部门',
  type: 'org',
  disableEdit: true
},
{
  field: 'targetOrgId',
  title: '目标部门',
  type: 'org',
  disableEdit: true
},

{
  field: 'originalPost',
  title: '原岗位',
  type: 'selected',
  isParams: true,
  paramsId: 'POST',
  searchable: true,
  disableEdit: true
},
{
  field: 'targetPost',
  title: '目标岗位',
  type: 'selected',
  isParams: true,
  paramsId: 'POST',
  searchable: true,
  disableEdit: true
},
{
  field: 'originalPostLevel',
  title: '原职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
},

{
  field: 'targetPostLevel',
  title: '目标职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
}, {
  field: 'salaryLow',
  title: '最低薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'salaryHigh',
  title: '最高薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'originalBaseSalary',
  title: '原基本底薪',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetBaseSalary',
  title: '目标基本底薪',
  type: 'text'
}, {
  field: 'originalPostSalary',
  title: '原岗位工资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetPostSalary',
  title: '目标岗位工资',
  type: 'text'
},
{
  field: 'originalAllowance',
  title: '原岗位津贴',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAllowance',
  title: '目标岗位津贴',
  type: 'text'
}, {
  field: 'originalAchievementBonus',
  title: '原绩效奖金',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAchievementBonus',
  title: '目标绩效奖金',
  type: 'text'
}, {
  field: 'originalFullattendReward',
  title: '原全勤奖',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetFullattendReward',
  title: '目标全勤奖',
  type: 'text'
}, {
  field: 'originalOtherReward',
  title: '原其他',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetOtherReward',
  title: '其他',
  type: 'text'
},
{
  field: 'originalSalary',
  title: '原薪资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetSalary',
  title: '目标薪资',
  type: 'text',
  disableEdit: true,
  showEditSituation: (form) => {
    form.targetSalary = Number(form.targetBaseSalary) + Number(form.targetPostSalary) + Number(form.targetAllowance) + Number(form.targetAchievementBonus) + Number(form.targetFullattendReward) + Number(form.targetOtherReward)
    return true
  }
},
{
  field: 'approvalOpinion',
  title: '审批意见',
  type: 'textarea',
  onlyRow: true
},
{
  field: 'taskId',
  title: 'taskId',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'action',
  title: 'action',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'taskDefKey',
  title: 'taskDefKey',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'procInstId',
  title: 'procInstIdww',
  type: 'text',
  disableEdit: true,
  hideEdit: true
}
]

/**
 * 调动的list
 */
export const turnoverListSetting = [{
  field: 'id',
  title: 'id',
  type: 'text',
  isHiden: true
},
{
  field: 'employeeNo',
  title: '员工编号',
  type: 'text',
  searchable: true
},
{
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  searchable: true
},
{
  field: 'orgName',
  title: '部门',
  type: 'text',
  searchable: true
},
{
  field: 'position',
  title: '岗位',
  type: 'selected',
  isParams: true,
  paramsId: 'POST',
  searchable: true
},
{
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  searchable: true
},
{
  field: 'statusName',
  title: '状态',
  type: 'text'
},
{
  field: 'status',
  title: '状态',
  type: 'text',
  isHiden: true
},
{
  field: 'taskDefKey',
  title: 'taskDefKey',
  type: 'text',
  isHiden: true
}
]

/**
 * 调动的详情
 */
export const turnoverDetailSetting = [{
  field: 'id',
  title: 'id',
  type: 'text',
  hideDetail: true
},
{
  field: 'employeeNo',
  title: '员工',
  type: 'text',
  disableEdit: true
}, {
  field: 'employeeName',
  title: '员工名称',
  type: 'text'
},
{
  field: 'turnoverType',
  title: '异动类型',
  type: 'radio',
  disableEdit: true,
  customText: (item) => {
    switch (item.turnoverType) {
      case '4':
        return '降级'
      case '3':
        return '晋升'
      case '5':
        return '调岗'
    }
  },
  optional: [{
    name: '调岗',
    value: '5'
  },
  {
    name: '晋升',
    value: '3'
  },
  {
    name: '降级',
    value: '4'
  }
  ]
}, {
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'originalOrgId',
  title: '原部门',
  type: 'org',
  disableEdit: true
},
{
  field: 'targetOrgId',
  title: '目标部门',
  type: 'org',
  disableEdit: true
},
{
  field: 'originalPost',
  title: '原岗位',
  type: 'text',
  disableEdit: true
},
{
  field: 'targetPost',
  title: '目标岗位',
  type: 'text',
  disableEdit: true
},

{
  field: 'originalPostLevel',
  title: '原职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
},

{
  field: 'targetPostLevel',
  title: '目标职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true

}, {
  field: 'salaryLow',
  title: '最低薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'salaryHigh',
  title: '最高薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'originalBaseSalary',
  title: '原基本底薪',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetBaseSalary',
  title: '目标基本底薪',
  type: 'text'
}, {
  field: 'originalPostSalary',
  title: '原岗位工资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetPostSalary',
  title: '目标岗位工资',
  type: 'text'
},
{
  field: 'originalAllowance',
  title: '原岗位津贴',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAllowance',
  title: '目标岗位津贴',
  type: 'text'
}, {
  field: 'originalAchievementBonus',
  title: '原绩效奖金',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAchievementBonus',
  title: '目标绩效奖金',
  type: 'text'
}, {
  field: 'originalFullattendReward',
  title: '原全勤奖',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetFullattendReward',
  title: '目标全勤奖',
  type: 'text'
}, {
  field: 'originalOtherReward',
  title: '原其他',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetOtherReward',
  title: '其他',
  type: 'text'
}, {
  field: 'originalSalary',
  title: '原薪资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetSalary',
  title: '目标薪资',
  type: 'text'
}, {
  field: 'effectDate',
  title: '生效日期',
  type: 'date',
  disableEdit: true
}
]


/**
 * 调动的审批
 */
export const turnoverApproveSetting = [{
  field: 'id',
  title: 'id',
  type: 'text',
  hideEdit: true
},
{
  field: 'employeeNo',
  title: '员工',
  type: 'text',
  disableEdit: true
}, {
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  disableEdit: true
}, {
  field: 'turnoverType',
  title: '异动类型',
  type: 'radio',
  disableEdit: true,
  customText: (item) => {
    switch (item.turnoverType) {
      case '4':
        return '降级'
      case '3':
        return '晋升'
      case '5':
        return '调岗'
    }
  },
  optional: [{
    name: '调岗',
    value: '5'
  },
  {
    name: '晋升',
    value: '3'
  },
  {
    name: '降级',
    value: '4'
  }
  ]
}, {
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'originalOrgId',
  title: '原部门',
  type: 'org',
  disableEdit: true
},
{
  field: 'targetOrgId',
  title: '目标部门',
  type: 'org',
  disableEdit: true
},
{
  field: 'originalPost',
  title: '原岗位',
  type: 'selected',
  isParams: true,
  paramsId: 'POST',
  disableEdit: true
},
{
  field: 'targetPost',
  title: '目标岗位',
  type: 'selected',
  isParams: true,
  paramsId: 'POST',
  disableEdit: true
},

{
  field: 'originalPostLevel',
  title: '原职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
},

{
  field: 'targetPostLevel',
  title: '目标职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
}, {
  field: 'salaryLow',
  title: '最低薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'salaryHigh',
  title: '最高薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'originalBaseSalary',
  title: '原基本底薪',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetBaseSalary',
  title: '目标基本底薪',
  type: 'text'
}, {
  field: 'originalPostSalary',
  title: '原岗位工资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetPostSalary',
  title: '目标岗位工资',
  type: 'text'
},
{
  field: 'originalAllowance',
  title: '原岗位津贴',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAllowance',
  title: '目标岗位津贴',
  type: 'text'
}, {
  field: 'originalAchievementBonus',
  title: '原绩效奖金',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAchievementBonus',
  title: '目标绩效奖金',
  type: 'text'
}, {
  field: 'originalFullattendReward',
  title: '原全勤奖',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetFullattendReward',
  title: '目标全勤奖',
  type: 'text'
}, {
  field: 'originalOtherReward',
  title: '原其他',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetOtherReward',
  title: '其他',
  type: 'text'
}, {
  field: 'originalSalary',
  title: '原薪资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetSalary',
  title: '目标薪资',
  type: 'text',
  disableEdit: true,
  showEditSituation: (form) => {
    form.targetSalary = Number(form.targetBaseSalary) + Number(form.targetPostSalary) + Number(form.targetAllowance) + Number(form.targetAchievementBonus) + Number(form.targetFullattendReward) + Number(form.targetOtherReward)
    return true
  }
},
{
  field: 'effectDate',
  title: '生效日期',
  type: 'date'
},
{
  field: 'approvalOpinion',
  title: '审批意见',
  type: 'textarea',
  onlyRow: true
},
{
  field: 'taskId',
  title: 'taskId',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'action',
  title: 'action',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'taskDefKey',
  title: 'taskDefKey',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'procInstId',
  title: 'procInstIdww',
  type: 'text',
  disableEdit: true,
  hideEdit: true
}
]



/**
 * 年度的list
 */
export const leaveListSetting = [{
  field: 'id',
  title: 'id',
  type: 'text',
  isHiden: true
},
{
  field: 'employeeNo',
  title: '员工编号',
  type: 'text',
  searchable: true
},
{
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  searchable: true
},
{
  field: 'orgName',
  title: '部门',
  type: 'text',
  searchable: true
},
{
  field: 'position',
  title: '岗位',
  type: 'selected',
  isParams: true,
  paramsId: 'POST',
  searchable: true
},
{
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  searchable: true
},
{
  field: 'statusName',
  title: '状态',
  type: 'text'
},
{
  field: 'status',
  title: '状态',
  type: 'text',
  isHiden: true
},
{
  field: 'taskDefKey',
  title: 'taskDefKey',
  type: 'text',
  isHiden: true
}
]



/**
 * 年度的详情
 */
export const leaveDetailSetting = [{
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  disableEdit: true
},
{
  field: 'orgId',
  title: '原部门',
  type: 'org',
  disableEdit: true
},
{
  field: 'position',
  title: '原岗位',
  type: 'text',
  disableEdit: true
},
{
  field: 'postLevel',
  title: '原职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
}, {
  field: 'targetLevel',
  title: '目标职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK'
}, {
  field: 'salaryLow',
  title: '最低薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'salaryHigh',
  title: '最高薪资',
  type: 'text',
  disableEdit: true
},

{
  field: 'originalBaseSalary',
  title: '原基本底薪',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetBaseSalary',
  title: '目标基本薪资',
  type: 'text'
}, {
  field: 'originalPostLevel',
  title: '原级别工资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetPostSalary',
  title: '目标级别薪资',
  type: 'text'
},
{
  field: 'originalAllowance',
  title: '原岗位津贴',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAllowance',
  title: '目标岗位津贴',
  type: 'text'
}, {
  field: 'originalAchievementBonus',
  title: '原绩效奖金',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAchievementBonus',
  title: '目标绩效奖金',
  type: 'text'
}, {
  field: 'originalFullattendReward',
  title: '原全勤奖',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetFullattendReward',
  title: '目标全勤奖',
  type: 'text'
}, {
  field: 'originalOtherReward',
  title: '原其他',
  type: 'text',
  disableEdit: true
},
{
  field: 'targetOtherReward',
  title: '其他',
  type: 'text'
}, {
  field: 'originalSalary',
  title: '原薪资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetSalary',
  title: '目标薪资',
  type: 'text'
},
{
  field: 'effectDate',
  title: '生效日期',
  type: 'date',
  disableEdit: true
}
]


/**
 * 离职的审批
 */
export const leaveApproveSetting = [{
  field: 'employeeNo',
  title: '员工编号',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  disableEdit: true
},
{
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'orgId',
  title: '原部门',
  type: 'org',
  disableEdit: true
},

{
  field: 'position',
  title: '原岗位',
  type: 'text',
  disableEdit: true
},
{
  field: 'postLevel',
  title: '原职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
}, {
  field: 'salaryLow',
  title: '最低薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'salaryHigh',
  title: '最高薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'baseSalary',
  title: '原基本底薪',
  type: 'text',
  disableEdit: true
}, {
  field: 'postLevelSalary',
  title: '原级别工资',
  type: 'text',
  disableEdit: true
},
{
  field: 'postAllowance',
  title: '原岗位津贴',
  type: 'text',
  disableEdit: true
}, {
  field: 'achievementBonus',
  title: '原绩效奖金',
  type: 'text',
  disableEdit: true
}, {
  field: 'fullAttendenceReward',
  title: '原全勤奖',
  type: 'text',
  disableEdit: true
}, {
  field: 'otherReward',
  title: '原其他',
  type: 'text',
  disableEdit: true
},
{
  field: 'targetLevel',
  title: '目标职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK'
},
{
  field: 'targetBaseSalary',
  title: '目标基本薪资',
  type: 'text'
}, {
  field: 'targetPostSalary',
  title: '目标级别薪资',
  type: 'text'
}, {
  field: 'targetAllowance',
  title: '目标岗位津贴',
  type: 'text'
}, {
  field: 'targetAchievementBonus',
  title: '目标绩效奖金',
  type: 'text'
}, {
  field: 'targetFullattendReward',
  title: '目标全勤奖',
  type: 'text'
}, {
  field: 'targetOtherReward',
  title: '其他',
  type: 'text'
},
{
  field: 'originalSalary',
  title: '原薪资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetSalary',
  title: '目标薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'effectDate',
  title: '生效日期',
  type: 'date',
  disableEdit: true
}, {
  field: 'approvalOpinion',
  title: '审批意见',
  type: 'textarea',
  onlyRow: true
},
{
  field: 'taskId',
  title: 'taskId',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'action',
  title: 'action',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'taskDefKey',
  title: 'taskDefKey',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'procInstId',
  title: 'procInstIdww',
  type: 'text',
  disableEdit: true,
  hideEdit: true
}
]



/**
 * 年度调薪的编辑
 */
export const editYearApproveSetting = [{
  field: 'employeeNo',
  title: '员工编号',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  disableEdit: true
}, {
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'orgId',
  title: '原部门',
  type: 'org',
  disableEdit: true
},
{
  field: 'position',
  title: '原岗位',
  type: 'selected',
  isParams: true,
  paramsId: 'POST',
  disableEdit: true
},
{
  field: 'postLevel',
  title: '原职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
}, {
  field: 'targetPostLevel',
  title: '目标职级',
  type: 'selected',
  options: [],

  init: (form, item) => {
    if (form.orgId && form.position) {
      const params = {
        orgId: form.orgId,
        postId: form.position
      }
      const options = []
      findLevel(params).then(response => {
        if (response.success) {
          if (response.data) {
            response.data.forEach(v => {
              const a = {
                name: v.name,
                value: v.id
              }
              options.push(a)
            })

            editYearApproveSetting.forEach(v => {
              if (v.field === 'targetPostLevel') {
                v.options = options
              }
            })
          }
        }
      })
    }
  },

  itemChange: (form, setting, c) => {
    if (form.targetPostLevel) {
      const params = {
        orgId: form.orgId,
        postId: form.position,
        postLevel: form.targetPostLevel
      }
      if (form.targetPostLevel) {
        findSalaryByLevel(params).then((response) => {
          form.salaryLow = response.data.salaryLow
          form.salaryHigh = response.data.salaryHigh
        })
      }
    }
  }
},
{
  field: 'salaryLow',
  title: '最低薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'salaryHigh',
  title: '最高薪资',
  type: 'text',
  disableEdit: true
},

{
  field: 'originalBaseSalary',
  title: '原基本底薪',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetBaseSalary',
  title: '目标基本薪资',
  type: 'text'
}, {
  field: 'originalPostLevel',
  title: '原级别工资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetPostSalary',
  title: '目标级别薪资',
  type: 'text'
},
{
  field: 'originalAllowance',
  title: '原岗位津贴',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAllowance',
  title: '目标岗位津贴',
  type: 'text'
}, {
  field: 'originalAchievementBonus',
  title: '原绩效奖金',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAchievementBonus',
  title: '目标绩效奖金',
  type: 'text'
}, {
  field: 'originalFullattendReward',
  title: '原全勤奖',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetFullattendReward',
  title: '目标全勤奖',
  type: 'text'
}, {
  field: 'originalOtherReward',
  title: '原其他',
  type: 'text',
  disableEdit: true
},

{
  field: 'targetOtherReward',
  title: '其他',
  type: 'text'
},
{
  field: 'salary',
  title: '原薪资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetSalary',
  title: '目标薪资',
  type: 'text',
  disableEdit: true,
  formChange: (form, setting) => {
    form.targetSalary = Number(form.targetBaseSalary) + Number(form.targetPostSalary) + Number(form.targetAllowance) + Number(form.targetAchievementBonus) + Number(form.targetFullattendReward) + Number(form.targetOtherReward)
  }
},
{
  field: 'effectDate',
  title: '生效日期',
  type: 'date',
  disableEdit: true
}, {
  field: 'approvalOpinion',
  title: '审批意见',
  type: 'textarea',
  onlyRow: true
},

{
  field: 'taskId',
  title: 'taskId',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'action',
  title: 'action',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'taskDefKey',
  title: 'taskDefKey',
  type: 'text',
  disableEdit: true,
  hideEdit: true
},
{
  field: 'procInstId',
  title: 'procInstIdww',
  type: 'text',
  disableEdit: true,
  hideEdit: true
}
]

/**
 * 年度调薪的详情页面
 */
export const yeardetailSetting = [{
  field: 'employeeNo',
  title: '员工编号',
  type: 'text',
  disableEdit: true,
  hideDetail: true
},

{
  field: 'employeeName',
  title: '员工名称',
  type: 'text',
  disableEdit: true
}, {
  field: 'entryDate',
  title: '入职日期',
  type: 'date',
  disableEdit: true
},
{
  field: 'orgId',
  title: '原部门',
  type: 'org',
  disableEdit: true
},
{
  field: 'position',
  title: '原岗位',
  type: 'text',
  disableEdit: true
},
{
  field: 'postLevel',
  title: '原职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK',
  disableEdit: true
}, {
  field: 'targetPostLevel',
  title: '目标职级',
  type: 'selected',
  isParams: true,
  paramsId: 'RANK'
}, {
  field: 'salaryLow',
  title: '最低薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'salaryHigh',
  title: '最高薪资',
  type: 'text',
  disableEdit: true
},
{
  field: 'originalBaseSalary',
  title: '原基本底薪',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetBaseSalary',
  title: '目标基本薪资',
  type: 'text'
}, {
  field: 'originalPostLevel',
  title: '原级别工资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetPostSalary',
  title: '目标级别薪资',
  type: 'text'
},
{
  field: 'originalAllowance',
  title: '原岗位津贴',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAllowance',
  title: '目标岗位津贴',
  type: 'text'
}, {
  field: 'originalAchievementBonus',
  title: '原绩效奖金',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetAchievementBonus',
  title: '目标绩效奖金',
  type: 'text'
}, {
  field: 'originalFullattendReward',
  title: '原全勤奖',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetFullattendReward',
  title: '目标全勤奖',
  type: 'text'
}, {
  field: 'originalOtherReward',
  title: '原其他',
  type: 'text',
  disableEdit: true
},
{
  field: 'targetOtherReward',
  title: '其他',
  type: 'text'
},

{
  field: 'originalSalary',
  title: '原薪资',
  type: 'text',
  disableEdit: true
}, {
  field: 'targetSalary',
  title: '目标薪资',
  type: 'text'
},
{
  field: 'effectDate',
  title: '生效日期',
  type: 'date'
}
]
